<?
dbdLoader::load("xajax.inc.php");
class dbdXajax extends xajax
{
	private $router;

	public function __construct(dbdRouter $router, $sRequestURI = "", $sWrapperPrefix = dbdDispatcher::XAJAX_ACTION_PREFIX, $sEncoding = XAJAX_DEFAULT_CHAR_ENCODING, $bDebug = false)
	{
		$this->router = $router;
		parent::xajax($sRequestURI, $sWrapperPrefix, $sEncoding, $bDebug);
		$this->exitAllowedOff();
	}

	public function _xmlToArray($rootTag, $sXml)
	{
		$args = parent::_xmlToArray($rootTag, $sXml);
		if (ini_get("magic_quotes_gpc"))
			array_walk_recursive($args, create_function('&$v,$k', '$v = addslashes($v);'));
		$this->router->addParam("dbdXajaxArgs", array($args));
		if (is_array($args))
		{
			foreach ($args as $k => $v)
			{
				if (is_string($k) && !is_numeric($k))
				{
					$this->router->setParam($k, $v);
				}
			}
		}
		return $args;
	}
}
?>